/*   1:    */ package com.atomikos.icatch.imp;
/*   2:    */ 
/*   3:    */ import com.atomikos.finitestates.TransitionTable;
/*   4:    */ import com.atomikos.icatch.TxState;
/*   5:    */ import java.util.Hashtable;
/*   6:    */ 
/*   7:    */ class TransactionTransitionTable
/*   8:    */   implements TransitionTable
/*   9:    */ {
/*  10:    */   protected Hashtable transitions;
/*  11:    */   protected static Hashtable defaultTransitions;
/*  12:    */   
/*  13:    */   protected static Hashtable defaultTransitions()
/*  14:    */   {
/*  15: 53 */     if (defaultTransitions == null)
/*  16:    */     {
/*  17: 55 */       Hashtable defaultTrans = new Hashtable();
/*  18: 56 */       Hashtable fromInit = new Hashtable();
/*  19:    */       
/*  20:    */ 
/*  21:    */ 
/*  22:    */ 
/*  23:    */ 
/*  24:    */ 
/*  25:    */ 
/*  26:    */ 
/*  27:    */ 
/*  28:    */ 
/*  29:    */ 
/*  30: 68 */       Hashtable fromActive = new Hashtable();
/*  31:    */       
/*  32: 70 */       fromActive.put(TxState.ACTIVE, new Object());
/*  33:    */       
/*  34: 72 */       fromActive.put(TxState.ABORTING, new Object());
/*  35: 73 */       fromActive.put(TxState.COMMITTING, new Object());
/*  36: 74 */       fromActive.put(TxState.PREPARING, new Object());
/*  37: 75 */       defaultTrans.put(TxState.ACTIVE, fromActive);
/*  38:    */       
/*  39:    */ 
/*  40:    */ 
/*  41:    */ 
/*  42:    */ 
/*  43:    */ 
/*  44:    */ 
/*  45:    */ 
/*  46:    */ 
/*  47:    */ 
/*  48:    */ 
/*  49:    */ 
/*  50:    */ 
/*  51:    */ 
/*  52:    */ 
/*  53:    */ 
/*  54: 92 */       Hashtable fromABORTING = new Hashtable();
/*  55: 93 */       fromABORTING.put(TxState.TERMINATED, new Object());
/*  56: 94 */       fromABORTING.put(TxState.ABORTING, new Object());
/*  57: 95 */       fromABORTING.put(TxState.HEUR_ABORTED, new Object());
/*  58: 96 */       fromABORTING.put(TxState.HEUR_COMMITTED, new Object());
/*  59: 97 */       fromABORTING.put(TxState.HEUR_MIXED, new Object());
/*  60: 98 */       fromABORTING.put(TxState.HEUR_HAZARD, new Object());
/*  61: 99 */       defaultTrans.put(TxState.ABORTING, fromABORTING);
/*  62:    */       
/*  63:101 */       Hashtable fromPREPARING = new Hashtable();
/*  64:102 */       fromPREPARING.put(TxState.IN_DOUBT, new Object());
/*  65:103 */       fromPREPARING.put(TxState.TERMINATED, new Object());
/*  66:104 */       fromPREPARING.put(TxState.ABORTING, new Object());
/*  67:    */       
/*  68:    */ 
/*  69:107 */       fromPREPARING.put(TxState.COMMITTING, new Object());
/*  70:    */       
/*  71:109 */       defaultTrans.put(TxState.PREPARING, fromPREPARING);
/*  72:    */       
/*  73:111 */       Hashtable fromIN_DOUBT = new Hashtable();
/*  74:112 */       fromIN_DOUBT.put(TxState.COMMITTING, new Object());
/*  75:113 */       fromIN_DOUBT.put(TxState.ABORTING, new Object());
/*  76:114 */       defaultTrans.put(TxState.IN_DOUBT, fromIN_DOUBT);
/*  77:    */       
/*  78:116 */       Hashtable fromCOMMING = new Hashtable();
/*  79:    */       
/*  80:    */ 
/*  81:    */ 
/*  82:120 */       fromCOMMING.put(TxState.TERMINATED, new Object());
/*  83:    */       
/*  84:    */ 
/*  85:123 */       fromCOMMING.put(TxState.HEUR_COMMITTED, new Object());
/*  86:124 */       fromCOMMING.put(TxState.HEUR_ABORTED, new Object());
/*  87:125 */       fromCOMMING.put(TxState.HEUR_MIXED, new Object());
/*  88:126 */       fromCOMMING.put(TxState.HEUR_HAZARD, new Object());
/*  89:127 */       defaultTrans.put(TxState.COMMITTING, fromCOMMING);
/*  90:    */       
/*  91:129 */       Hashtable fromHEURCOMM = new Hashtable();
/*  92:130 */       fromHEURCOMM.put(TxState.TERMINATED, new Object());
/*  93:    */       
/*  94:132 */       defaultTrans.put(TxState.HEUR_COMMITTED, fromHEURCOMM);
/*  95:    */       
/*  96:134 */       Hashtable fromHEURMIXED = new Hashtable();
/*  97:135 */       fromHEURMIXED.put(TxState.HEUR_MIXED, new Object());
/*  98:    */       
/*  99:137 */       fromHEURMIXED.put(TxState.TERMINATED, new Object());
/* 100:138 */       defaultTrans.put(TxState.HEUR_MIXED, fromHEURMIXED);
/* 101:    */       
/* 102:140 */       Hashtable fromHEURHAZARD = new Hashtable();
/* 103:141 */       fromHEURHAZARD.put(TxState.HEUR_HAZARD, new Object());
/* 104:    */       
/* 105:143 */       fromHEURHAZARD.put(TxState.TERMINATED, new Object());
/* 106:144 */       defaultTrans.put(TxState.HEUR_HAZARD, fromHEURHAZARD);
/* 107:    */       
/* 108:146 */       Hashtable fromHEURABORTED = new Hashtable();
/* 109:147 */       fromHEURABORTED.put(TxState.TERMINATED, new Object());
/* 110:148 */       fromHEURABORTED.put(TxState.HEUR_ABORTED, new Object());
/* 111:149 */       defaultTrans.put(TxState.HEUR_ABORTED, fromHEURABORTED);
/* 112:    */       
/* 113:151 */       Hashtable fromTERMINATED = new Hashtable();
/* 114:152 */       fromTERMINATED.put(TxState.TERMINATED, new Object());
/* 115:153 */       defaultTrans.put(TxState.TERMINATED, fromTERMINATED);
/* 116:154 */       defaultTransitions = defaultTrans;
/* 117:    */     }
/* 118:156 */     return defaultTransitions;
/* 119:    */   }
/* 120:    */   
/* 121:    */   public TransactionTransitionTable()
/* 122:    */   {
/* 123:163 */     this.transitions = defaultTransitions();
/* 124:    */   }
/* 125:    */   
/* 126:    */   public TransactionTransitionTable(Hashtable edges)
/* 127:    */   {
/* 128:169 */     this.transitions = edges;
/* 129:    */   }
/* 130:    */   
/* 131:    */   public void setTransitions(Hashtable edges)
/* 132:    */   {
/* 133:174 */     this.transitions = edges;
/* 134:    */   }
/* 135:    */   
/* 136:    */   public boolean legalTransition(Object from, Object to)
/* 137:    */   {
/* 138:188 */     if (this.transitions == null) {
/* 139:189 */       return false;
/* 140:    */     }
/* 141:190 */     if (!this.transitions.containsKey(from)) {
/* 142:191 */       return false;
/* 143:    */     }
/* 144:194 */     Object allowedNextStates = this.transitions.get(from);
/* 145:195 */     if (!(allowedNextStates instanceof Hashtable)) {
/* 146:196 */       return false;
/* 147:    */     }
/* 148:199 */     Hashtable toStates = (Hashtable)allowedNextStates;
/* 149:202 */     if (toStates.containsKey(to)) {
/* 150:203 */       return true;
/* 151:    */     }
/* 152:205 */     return false;
/* 153:    */   }
/* 154:    */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions\3.7.0\transactions-3.7.0.jar
 * Qualified Name:     com.atomikos.icatch.imp.TransactionTransitionTable
 * JD-Core Version:    0.7.0.1
 */